import psutil

# 获取当前系统的分区使用情况
# partitions = psutil.disk_partitions()

# 遍历分区，获取每个分区的使用情况
# for partition in partitions:
#
#     usage = psutil.disk_usage(partition.device)
#     print("usage", partition) # usage sdiskpart(device='E:\\', mountpoint='E:\\', fstype='NTFS', opts='rw,fixed', maxfile=255, maxpath=260)
#     if usage.total > 10 * 1024 ** 3:  # 如果总空间大于10GB，则打印信息
#         print(f"Device: {partition.device}")
#         print(f"Total Space: {usage.total / 1024 ** 3:.2f} GB")
#         print(f"Used: {usage.used / 1024 ** 3:.2f} GB")
#         print(f"Free: {usage.free / 1024 ** 3:.2f} GB")
#         print(f"Percentage Used: {usage.percent}%")
import psutil
usage = psutil.disk_usage(r"E:")

print("usage E",usage)

print(usage.free)
# print(f"Free: {usage.free / 1024 ** 3:.2f} GB")
free1 = usage.free
free = f"Free: {usage.free / 1024 ** 3:.2f} GB"


if free1 < 10 * 1024 ** 3:
    print("free",free)